from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import LifecycleNode
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument

import lifecycle_msgs.msg
import os

def generate_launch_description():
    pkg_name = 'wf_task1_pkg'
    param_dir = os.path.join(get_package_share_directory(pkg_name), 'param')
    param_path = os.path.join(param_dir, 'defaults.param.yaml')

    talker_node = LifecycleNode(
        package=pkg_name, 
        executable=pkg_name + '_talker_exe', 
        name=pkg_name + '_talker_node', 
        output='screen', 
        parameters=[param_path]
    )

    listener_node = LifecycleNode(
        package=pkg_name, 
        executable=pkg_name + '_listener_exe', 
        name=pkg_name + '_listener_node', 
        output='screen', 
        parameters=[param_path]
    )

    return LaunchDescription([
        talker_node, 
        listener_node
    ])

